{include file="public/_meta" /}
<body>
<div class="wrapper">

    {include file="public/_header" /}

    <!-- Sidebar -->
    {include file="public/_menu" /}
    <!-- End Sidebar -->

    <div class="main-panel">

        <div class="content">
            <div class="page-inner">

                <!-- 面包屑 -->
                {include file="public/_page_header" /}

                <div class="row">
                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <div class="d-flex align-items-center">
                                    <h4 class="card-title">修改密码</h4>

                                </div>
                            </div>
                            <div class="card-body">
                                <div class="modal-body">
                                    <form id="form-modal">
                                        <div class="row col-md-6">
                                            <div class="form-group form-inline col-md-12">
                                                <label class="col-md-3 col-form-label"><font style="vertical-align: inherit;">管理员名称</font></label>
                                                <div class="col-md-8 p-0">
                                                    {$admin.phone}
                                                </div>
                                            </div>

                                            <div class="form-group form-inline col-md-12">
                                                <label for="password" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">新密码</font></label>
                                                <div class="col-md-8 p-0">
                                                    <input type="password" class="form-control input-full" id="password" name="password" placeholder="新密码">
                                                </div>
                                            </div>
                                            <div class="form-group form-inline col-md-12">
                                                <label for="password2" class="col-md-3 col-form-label"><font style="vertical-align: inherit;">确认密码</font></label>
                                                <div class="col-md-8 p-0">
                                                    <input type="password" class="form-control input-full" id="password2" name="password2" placeholder="确认密码">
                                                </div>
                                            </div>

                                            <div class="form-group form-inline col-md-12">
                                                <input type="hidden" name="id" value="{$admin.id}">
                                                <button type="submit" id="addRowButton" class="btn btn-primary" style="margin-left: 70%;">保存</button>
                                            </div>
                                        </div>

                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        {include file="public/_footer" /}


    </div>



</div>

{include file="public/_js" /}

</body>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    var SCOPE = {
        'add_url':"{:url('index/save_password')}"
    };


    $(function(){
        /*表单验证*/
        $("#form-modal").validate({
            rules:{
                password:{
                    required:true,
                    minlength:6,
                    maxlength:10
                },
                password2:{
                    equalTo: "#password"
                }

            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                var url = SCOPE.add_url;
                /*表单提交*/
                $(form).ajaxSubmit({
                    type: 'post',
                    url: url,
                    success: function(data){
                        if(data.code == 1001){
                            layer.msg(data.msg, {
                                icon: 1,
                                time: 2000
                            }, function(){
                                parent.location.reload();
                            });
                        }else{
                            layer.msg(data.msg,{icon:2,time:2000});
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg(errorThrown,{icon:2,time:2000});
                    }
                });

            }
        });

    });








</script>
</html>




























